package com.woniuxy.commons.interceptor.configuration;

/**
 * @author： 雷鹏
 * Date: 2020/7/22 0:43
 */
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.woniuxy.commons.interceptor.AuthInterceptor;

@Configuration
public class InterceptorConfiguration implements WebMvcConfigurer{

    @Autowired
    private AuthInterceptor authInterceptor;

    //将我们自定义的方法拦截器添加到拦截器列表中，并且指定拦截哪些请求
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor).addPathPatterns("/**");
    }

}
